home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / BBS / MUBBS / E-Mail 1.5 source.cpt / E-mail / EmailOnLogin.c < prev    next >
Text File  |  1992-01-03  |  3KB  |  105 lines

  1. /* *********************************************************************************
  2.      
  3.       MODULE:        EmailOnLogin Module
  4.       
  5.      DESCRIPTION:    This EmailOnLogin Module is a simple module for MUBBS, the
  6.                      Multi-User Bulliten Board System Software.
  7.                      
  8.      AUTHOR:        Noam Freedman
  9.      
  10.      Copyright © 1990 by Noam Freedman. Portions are also Copyright Symantec Corp.
  11.  
  12.      This program source code and it's compiled version IS NOT IN THE
  13.      PUBLIC DOMAIN ! Please read the "COPYRIGHT NOTICE / NMF" file for details
  14.      regarding use of this program source code and it's compiled version.
  15.      
  16.      Revision History:
  17.      ============================================================
  18.      10/20/91 - Started programming
  19.      11/ 4/91 - Edited for release
  20.      12/12/91 - Bug fixes, N Hawthorn
  21.      ============================================================
  22.      
  23.  
  24.     ******************************************************************************** */
  25.  
  26. #define INMAIN
  27.  
  28. #include "MUBBS Module.h"
  29. #include <SetUpA4.h>
  30. #include "Email.h"
  31.  
  32.  
  33. pascal void main (mode1,G1,P1) /* called from the main routines, and what mode to be in */
  34. int mode1;
  35. struct GS *G1; /* we point to the "global" struct in the Main Module here */
  36. Ptr P1; /* we ignore this pointer, we do not use it at all */
  37. {
  38. Handle temph;
  39. float version = 0.5; /* what version of MUBBS you are compatable with IE: .5 and above */
  40. RememberA0(); SetUpA4(); /* This sets up the A4 register to access our globals */
  41. asm { _RecoverHandle }; asm {move.l a0,temph}; HLock(temph); /* locks our module, do this ! */
  42.  
  43. G=G1; /* This MUST be the first thing you do in main only, it sets up the struct globals */
  44. mode[u]=mode1; /* set up our mode so that you can read it anywhere */
  45.  
  46. switch (mode[u]) { /* any un-handled modes return error from this module */
  47.     case 2:
  48.         dostuff();
  49.         G->moduleresult=0;
  50.         break;
  51.     case 98:
  52.         versionck(version); /* just return after this call, don't modify anything */
  53.         break;        
  54.     case 0:
  55.         strcpy (G->programmer,"Noam Freedman"); /* show the programmer's name up to 20 chars*/
  56.         G->moduleresult=0; /* this was also a init call if we need close call put 99 here */
  57.         break;
  58.     default:
  59.         G->moduleresult=1; /* return bad code */
  60.     };
  61.  
  62. HUnlock(temph); /* unlocks this module, do this ! */
  63. RestoreA4(); /* call this when you are all done */
  64. }
  65.  
  66. dostuff()
  67. {
  68.  
  69. if (!G->online[u]) { return; } /* do this check so we can log out if hang up */
  70.  
  71. if (anymail()) {
  72.  
  73.     send("]*************************]");
  74.     send( "*     YOU HAVE MAIL !   *]");
  75.     send( "*************************]");
  76.     if (!cmd1("]Would you like to go to the Mail Menu now (Y/N)? ") )  return;
  77.     send(G->CR[u]);
  78.     if (G->input[u] == 'Y')
  79.         {
  80.         module (2,"check_for_email",0L);
  81.         send("]]Continuing with log on...]]");
  82.         }
  83.     }
  84. }
  85.  
  86.  
  87. anymail() /* "LoadStruct" takes up lots of stack space, when we return it's gone! */
  88. {
  89. struct LoadStruct S;
  90. FILE *fp_headers;
  91.  
  92. module (3,"check_email",&S);
  93.  
  94. if (S.result == 21)
  95.     {
  96.     send("]You have no mail waiting.]");
  97.     return FALSE;
  98.     }
  99.  
  100. if (S.result != 0 && S.result != 20) return FALSE;
  101.  
  102. return TRUE;
  103. }
  104.  
  105.